/**
 * 
 */
package com.honeywell.config;

import javax.servlet.Filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.honeywell.filter.SimpleCORSFilter;

/**
 * @author admin 
 * @Date 2016年6月23日下午2:31:17
 * 添加自定义的过滤器，解决跨域问题
 */
@Configuration
public class FilterConfig {
	
	@Bean
	public FilterRegistrationBean crosFilterRegistration() {

	    FilterRegistrationBean registration = new FilterRegistrationBean();
	    registration.setFilter(crosFilter());
	    registration.addUrlPatterns("/*");
	    registration.setName("crosFilter");
	    registration.setOrder(1);
	    return registration;
	} 

	@Bean(name = "crosFilter")
	public Filter crosFilter() {
	    return new SimpleCORSFilter();
	}
	
	
}
